<template>
  <div class="form3">
    <Header_></Header_>
    <div class="form3_container">
      <el-form :model="form3Data" :rules="rules" ref="form3" label-width="80px" class="demo-ruleForm" :status-icon="statusIcon" label-position="top">
        <Content1_ :form3Data="form3Data"></Content1_>
        <Content2 :form3Data="form3Data"></Content2>
        <!--        下一步按钮-->
        <el-form-item class="btn-container">
          <el-button @click="resetForm('form3')">重置</el-button>
          <el-button type="primary" @click="submitForm('form3')">下一步</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>

import Header_ from './component/Header_'
import Content1_ from './component/Content1_'
import Content2 from './component/Content2'

export default {
  name: 'index',
  components: {Content1_, Header_, Content2},
  data() {
    return {
      statusIcon: true,
      form3Data: {
        intention_job: '',
        working_place: '',
        desired_industry: '',
        expected_salary: '',
        negotiable: '',
        self_assessment: ''
      },
      rules: {
        intention_job: [
          {required: true, message: '请输入意向岗位', trigger: 'blur'}
        ],
        working_place: [
          {required: true, message: '请输入工作地点', trigger: 'blur'}
        ],
        desired_industry: [
          {required: true, message: '请输入期望从事行业', trigger: 'blur'}
        ],
        expected_salary: [
          {required: true, message: '请输入期望从事行业', trigger: 'blur'}
        ]
      }
    }
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          alert('submit!')
          console.log(this.form3Data)
          this.$router.push('/form4')
        } else {
          console.log('error submit!!')
          return false
        }
      })
    },
    resetForm(formName) {
      this.$refs[formName].resetFields()
    }
  }
}
</script>

<style lang="scss" scoped>
.form3 {
  box-sizing: border-box;
  margin: 0 auto;
  width: 500px;
  overflow: auto;
  background-color: #ffffff;
  border: 1px solid #cccccc;
  border-radius: 12px;
  margin-top: 20px;

  .form3_container {
    padding: 0 20px;

    .btn-container {
      display: flex;
      justify-content: flex-end;
    }
  }
}

</style>
